<?php
include("include/textcenter.php");
include("include/db.php");
    $id = $_GET["id"];
    $sqlorder = "Select * from vnf_shop_order where order_id='$id'";
	$order = mysql_query($sqlorder);
    
    $value =  mysql_query("SELECT * from tblpartners");
	$select = '';
	$select = '<select name="PartnerID">';
	while($v = mysql_fetch_array($value))
    {
		if($v['id'] == $row['PartnerID'])
		{
			$select .= '<option selected value="'.$v['id'].'">'.$v['Title'].'</option>';
		}
		else
		{
			$select .= '<option value="'.$v['id'].'">'.$v['Title'].'</option>';
		}
	}
	$select .= '</select>';
    
    if(isset($_POST['UpateAddressBill']))
    {
        $id = $_GET["id"]; 
        $BillToAddress=stripcslashes($_POST["BillToAddress"]);
        $BillToCity=stripcslashes($_POST["BillToCity"]);
        $BillToState=stripcslashes($_POST["BillToState"]);
        $BillToZipCode=stripcslashes($_POST["BillToZipCode"]);
        $BillToCountry=stripcslashes($_POST["BillToCountry"]);
        $BillToFirstName=stripcslashes($_POST["BillToFirstName"]);
        $BillToLastName=stripcslashes($_POST["BillToLastName"]);
        $BillToEmail=stripcslashes($_POST["BillToEmail"]);
        $BillToPhone=stripcslashes($_POST["BillToPhone"]);
          
        $sqlQuery = "Update vnf_shop_order set `date_updated` = '".date('Y-m-d H:i:s', time())."', 
        `BillToAddress` = '".$BillToAddress."', `BillToCity` = '".$BillToCity."', 
        `BillToState` = '".$BillToState."', `BillToZipCode` = '".$BillToZipCode."', 
        `BillToCountry` = '".$BillToCountry."', `BillToLastName` = '".$BillToLastName."'
        , `BillToFirstName` = '".$BillToFirstName."', `BillToEmail` = '".$BillToEmail."'
        , `BillToPhone` = '".$BillToPhone."' where order_id='".$id."'";
         mysql_query($sqlQuery);
    }
    if(isset($_POST['UpateAddressShip']))
    {
         $id = $_GET["id"];
         $ShipToAddress=$_POST["ShipToAddress"];
        $ShipToCity=stripcslashes($_POST["ShipToCity"]);
        $ShipToState=stripcslashes($_POST["ShipToState"]);
        $ShipToZipCode=stripcslashes($_POST["ShipToZipCode"]);
        $ShipToCountry=stripcslashes($_POST["ShipToCountry"]);
        $ShipToFirstName=stripcslashes($_POST["ShipToFirstName"]);
        $ShipToLastName=stripcslashes($_POST["ShipToLastName"]);
        $ShipToEmail=stripcslashes($_POST["ShipToEmail"]);
        $ShipToPhone=stripcslashes($_POST["ShipToPhone"]);
           
        $sqlQuery = "Update vnf_shop_order set `date_updated` = '".date('Y-m-d H:i:s', time())."', 
        `ShipToAddress` = '".$ShipToAddress."', `ShipToCity` = '".$ShipToCity."', 
        `ShipToState` = '".$ShipToState."', `ShipToZipCode` = '".$ShipToZipCode."', 
        `ShipToCountry` = '".$ShipToCountry."', `ShipToFirstName` = '".$ShipToFirstName."', 
        `ShipToLastName` = '".$ShipToLastName."', `ShipToEmail` = '".$ShipToEmail."', 
        `ShipToPhone` = '".$ShipToPhone."' where order_id='".$id."'";
         mysql_query($sqlQuery);
    }
    if(isset($_POST['updatebilliformation']))
    {
         $id = $_GET["id"]; 
         $PaymentMethod=$_POST["PaymentMethod"];
         $MasterCard=$_POST["MasterCard"];
         $StoreCreditAmount=$_POST["StoreCreditAmount"];
         $sqlQuery = "Update vnf_shop_order set `date_updated` = '".date('Y-m-d H:i:s', time())."', 
        `PaymentMethod` = '".$PaymentMethod."', `MasterCard` = '".$MasterCard."', 
        `StoreCreditAmount` = '".$StoreCreditAmount."' where order_id='".$id."'";
         mysql_query($sqlQuery);
    }
    
    if(isset($_POST['updateorder']))
    {
        $id = $_GET["id"]; 
         $GiftWrapYN=$_POST["GiftWrapYN"];
        
         $coupon_code=$_POST["coupon_code"];
         $Message=$_POST["Message"];
          $sqlQuery = "Update vnf_shop_order set `date_updated` = '".date('Y-m-d H:i:s', time())."', 
        `GiftWrapYN` = '".$GiftWrapYN."', `coupon_code` = '".$coupon_code."', 
        `Message` = '".$Message."' where order_id='".$id."'";
         mysql_query($sqlQuery);
    }  
	else
	{
		//echo '<meta http-equiv="Refresh" content="0;URL=index.php?com=order" />';
	}	
  
	while($row = mysql_fetch_array($order))
{
 ?>
 <html>
<head>
<meta name="description" content="Admin<?php echo $tagdescription?>">
<meta name="keywords" content="<?php echo $tagkeywords?> Main">
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title><?php echo $tagtitle?></title>

<script type="text/javascript" src="simpletreemenu.js">
/***********************************************
* Simple Tree Menu- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
</script>
<link rel="stylesheet" type="text/css" href="simpletree.css" />
<LINK rel="StyleSheet" href="include/css_classes.css" type="text/css">

</head>



<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" link="#0000FF" vlink="#800080" alink="#FF0000" bgcolor="#FFFFFF">
<!-- -------------------Header---------------------------- -->
<?php include("include/header.php"); ?>
<!-- -------------------End Header---------------------------- -->


<div align="center">
<table border="0" cellspacing="0" cellpadding="0">

	<tr>
		<td width="12%" valign="top">
		<img border="0" src="public/images/homepage/spider16.gif" width="200" height="1"></td>
		<td width="1%" valign="top">
		<img border="0" src="public/images/homepage/spider16.gif" width="16" height="1"></td>
		<td width="86%" valign="top">
		<img border="0" src="public/images/homepage/spider16.gif" width="16" height="1"></td>
	</tr>	
	<tr>
		<!-- ///////////////////Begin Leftmenu/////////////////// -->
		<td width="12%" valign="top" bgcolor="#FFFFFF">
		<?php include("include/leftmenu.php"); ?>
		</td>
		<!-- ///////////////////End Leftmenu/////////////////// -->
		
		<td width="1%" valign="top" background="public/images/homepage/16.gif">&nbsp;</td>
		<td width="86%" valign="top">
	<br>
<!-- -------------------Begin Body---------------------------- -->
    <form action="" method="post" id="contactform">
	<table width="98%" style="font-weight:bold; font-size:10pt;" border="0">
		<tr>
			<td align="center" colspan="2" height="50"><b style="font-size:12pt; color:Blue;">Update Order</b></td>
		</tr> 
        
        <tr>
            <td colspan="2">
            <fieldset style="border:1px solid #cccccc;padding-left:10px;padding-bottom:0px; margin-bottom:10px; width:95%;">
             <legend>
            <b style="font-size:14px;">Address information</b>
            </legend>
            <div style="float: left; margin-right: 15px; width: 45%; margin-left:20px;">
            <fieldset style="border:1px solid #cccccc;padding-left:10px;padding-bottom:0px; margin-bottom:10px; width:430px;">
             <legend>
            <b style="font-size:14px;">Bill To </b>
            </legend>
            <br />
             <div style="margin-bottom:10px;">
             <form method="post" action="">
             <table>
                <tr>
                    <td>
                    First Name: 
                    </td>
                    <td>
                    <input type="text" id="" name="BillToFirstName" value="<?php echo $row['BillToFirstName'];?>" />
                    </td>
                </tr>
                <tr>
                    <td>
                    Last Name: 
                    </td>
                    <td>
                    <input type="text" id="" name="BillToLastName" value="<?php echo $row['BillToLastName'];?>" />
                    </td>
                </tr>
                <tr>
                    <td>
                    Email: 
                    </td>
                    <td>
                    <input type="text" id="" name="BillToEmail" value="<?php echo $row['BillToEmail'];?>" />
                    </td>
                </tr>
                <tr>
                    <td>
                    Phone: 
                    </td>
                    <td>
                    <input type="text" id="" name="BillToPhone" value="<?php echo $row['BillToPhone'];?>" />
                    </td>
                </tr>
                <tr>
                    <td>
                    Address: 
                    </td>
                    <td>
                    <input type="text" id="" name="BillToAddress" value="<?php echo $row['BillToAddress'];?>" />
                    </td>
                </tr>
                <tr>
                    <td>
                     City: 
                    </td>
                    <td>
                     <input type="text" id="BillToCity" name="BillToCity" value="<?php echo $row['BillToCity'];?>" />
                    </td>
                </tr>
                <tr>
                    <td>
                    State: 
                    </td>
                    <td>
                    <input type="text" id="BillToState" name="BillToState" value="<?php echo $row['BillToState'];?>" /> 
                    </td>
                </tr>
                <tr>
                    <td>
                     ZipCode: 
                    </td>
                    <td>
                     <input type="text" id="BillToZipCode" name="BillToZipCode" value="<?php echo $row['BillToZipCode'];?>" />
                    </td>
                </tr>
                <tr>
                    <td>
                     Country: 
                    </td>
                    <td>
                     <input type="text" id="BillToCountry" name="BillToCountry" value="<?php echo $row['BillToCountry'];?>" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <input type="hidden" name="order_id" value="<?php echo $row['order_id'];?>" />
                        <input type="submit" name="UpateAddressBill" value="Update" />
                    </td>
                </tr>
             </table>
            </form>
            </div>
            </fieldset>
            </div>
            <div style="float: left; margin-right: 30px; width: 45%; margin-left:20px;">
            <fieldset style="border:1px solid #cccccc;padding-left:10px;padding-bottom:0px; margin-bottom:10px; width:430px;">
             <legend>
            <b style="font-size:14px;">Ship To</b>
            </legend>
            <br />
            <div style="margin-bottom: 10px;">
            <form method="post" action="">
            <table>
                <tr>
                    <td>
                    First Name: 
                    </td>
                    <td>
                    <input type="text" id="" name="ShipToFirstName" value="<?php echo $row['ShipToFirstName'];?>" />
                    </td>
                </tr>
                <tr>
                    <td>
                    Last Name: 
                    </td>
                    <td>
                    <input type="text" id="" name="ShipToLastName" value="<?php echo $row['ShipToLastName'];?>" />
                    </td>
                </tr>
                <tr>
                    <td>
                    Email: 
                    </td>
                    <td>
                    <input type="text" id="" name="ShipToEmail" value="<?php echo $row['ShipToEmail'];?>" />
                    </td>
                </tr>
                <tr>
                    <td>
                    Phone: 
                    </td>
                    <td>
                    <input type="text" id="" name="ShipToPhone" value="<?php echo $row['ShipToPhone'];?>" />
                    </td>
                </tr>
                <tr>
                    <td>
                    Address: 
                    </td>
                     <td>
                    <input type="text" id="ShipToAddress" name="ShipToAddress" value="<?php echo $row['ShipToAddress'];?>" />	
                     <input type="hidden" name="order_id" value="<?php echo $row['order_id'];?>" />
                    </td>
                </tr>
                <tr>
                    <td>
                     City: 
                    </td>
                     <td>
                     <input type="text" id="ShipToCity" name="ShipToCity" value="<?php echo $row['ShipToCity'];?>" /> 
           
                    </td>
                </tr>
                <tr>
                    <td>
                     State: 
           
                    </td>
                     <td>
                     <input type="text" id="ShipToState" name="ShipToState" value="<?php echo $row['ShipToState'];?>" /> 
           
                    </td>
                </tr>
                <tr>
                    <td>
                     ZipCode: 
                    </td>
                     <td>
                     <input type="text" id="ShipToZipCode" name="ShipToZipCode" value="<?php echo $row['ShipToZipCode'];?>" /> 
           
                    </td>
                </tr>
                <tr>
                    <td>
                     Country: 
           
                    </td>
                     <td>
                     <input type="text" id="ShipToCountry" name="ShipToCountry" value="<?php echo $row['ShipToCountry'];?>" />
                    </td>
                </tr>
                 <tr>
                    <td colspan="2">
                        <input type="submit" name="UpateAddressShip" value="Update" />
                    </td>
                </tr>
            </table>
            </form>
            </div>
            </fieldset>
            </div>
            </div>
            </fieldset>
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <div style="width: 45%;">
              
             <fieldset>
                    <legend>
                    <b style="font-size:14px;">Bill information</b>
                    </legend>
                    <br />
                    <form method="post" action="">
                    <table>
                        <tr>
                            <td>
                                Current Pay Method
                            </td>
                            <td>
                                <input type="text" name="PaymentMethod" id="PaymentMethod" value="<?php echo $row['PaymentMethod'] ?>" />
                                 <input type="hidden" name="order_id" value="<?php $row['order_id'];?>" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Additional Credit Data
                            </td>
                            <td>
                                <input type="text" name="MasterCard" id="MasterCard" value="<?php echo $row['MasterCard'] ?>" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Store credit
                            </td>
                            <td>
                                <input type="text" name="StoreCreditAmount" id="StoreCreditAmount" value="<?php echo $row['StoreCreditAmount'] ?>" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                            
                            </td>
                            <td>
                                <input type="submit" name="updatebilliformation" value="Update" />
                            </td>
                        </tr>
                    </table>
                    </form>
                </fieldset>
           </div>
           </td>
           </tr>
           <tr>
           <td colspan="2">
           
            <div style="float: left; width: 50%;">
            <fieldset style="border:1px solid #cccccc;padding-left:10px;padding-bottom:0px; margin-bottom:10px; width:430px;">
             <legend>
            <b style="font-size:14px;">Order Detail</b>
            </legend>
            <br />
            <div style="margin-bottom: 10px;">
            <form method="post" action="">
            <table>
                <tr>
                    <td>
                    Order Type:
                    </td>
                     <td>
                      <input type="radio" value="" /> Create a complete/Paid invoice<br />
                      <input type="radio" value="" /> Create an outstanding invoice to paid online
                    </td>
                </tr>
                <tr>
                    <td>
                     Note: 
                    </td>
                     <td>
                     <input type="text" id="Message" name="Message" value="<?php echo $row['Message'];?>" /> <br /><br />
                     <input type="hidden" name="order_id" value="<?php $row['order_id'];?>" />
                    </td>
                </tr>
                <tr>
                    <td>
                     Promotion Code: 
           
                    </td>
                     <td>
                     <input type="text" id="coupon_code" name="coupon_code" value="<?php echo $row['coupon_code'];?>" /> <br /><br />
           
                    </td>
                </tr>
                <tr>
                    <td>
                     Gift Wrap: 
                    </td>
                     <td>
                     <input type="checkbox" name="GiftWrapYN" value="<?php echo $row['coupon_code'];?>"/>
           
                    </td>
                </tr>
                <tr>
                    <td>
                     Pucharse for Resale: 
           
                    </td>
                     <td>
                     <input type="checkbox" name="" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                    
                        <input type="submit" name="updateorder" value="Update" />
                    </td>
                </tr>
            </table>
            </form>
            </div>
            </fieldset>
            </div>
            </td>
        </tr>  
		<!--<tr>
			<td colspan="2" height="40">
				<input type="submit" name="btnUpdate" id="btnUpdate" value="Update" />
			</td>
		</tr>-->
    </table>
</form><br><br>
<i>Please fill in these fields (<font style="color: red;">*</font>)</i>
 <?php
    }
 ?>
 </body>

</html>